home *** CD-ROM | disk | FTP | other *** search
/ Programming an RTS Game with Direct3D / Programming an RTS Game with Direct3D.iso / Examples / Chapter 16 / Example 16.1 / player.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-06-30  |  2.0 KB  |  79 lines

  1. #ifndef _RTS_PLAYER_
  2. #define _RTS_PLAYER_
  3.  
  4. #include <vector>
  5. #include "shader.h"
  6. #include "camera.h"
  7. #include "unit.h"
  8. #include "building.h"
  9. #include "terrain.h"
  10. #include "masterAI.h"
  11.  
  12. void LoadPlayerResources(IDirect3DDevice9* m_pDevice);
  13. void UnloadPlayerResources();
  14. float GetCost(int type, bool m_isBuilding);
  15.  
  16. #define HUMAN 0
  17. #define COMPUTER 1
  18. #define NETWORK 2
  19.  
  20. class PLAYER
  21. {
  22.     friend class APPLICATION;
  23.     friend class MASTERAI;
  24.     friend class BUILDING;
  25.     friend class UNIT;
  26.     friend class CONSTRUCT_BUILDING;
  27.     friend class SMALL_ATTACK;
  28.     friend class STRATEGY_MAP;
  29.     public:
  30.         PLAYER(int _teamNo, int _controller, D3DXVECTOR4 _teamCol, INTPOINT startPos, TERRAIN* _terrain, IDirect3DDevice9* _Device);
  31.         ~PLAYER();
  32.  
  33.         MAPOBJECT* AddMapObject(int type, INTPOINT mp, bool m_isBuilding, bool finished);
  34.         void RemoveMapObject(MAPOBJECT *mapObject);
  35.  
  36.         void RenderMapObjects(CAMERA &camera);
  37.         void PaintSelectedMapObjects(CAMERA &camera);
  38.         void UpdateMapObjects(float deltaTime);
  39.         INTPOINT FindClosestBuildingLocation(int buildType, INTPOINT mp);
  40.         void Select(MOUSE &mouse);
  41.         void UnitOrders(MOUSE &mouse, std::vector<PLAYER*> &players, CAMERA &camera);
  42.         INTPOINT GetCenter();
  43.         void IsMapObjectsVisible();
  44.         void Menu(MOUSE &mouse);
  45.  
  46.         bool InBattle();
  47.         bool Alive();
  48.  
  49.         void PlaceBuilding(MOUSE &mouse, CAMERA &camera);
  50.         bool HasMapObject(int type, bool m_isBuilding);
  51.         RECT GetBaseArea();
  52.  
  53.         BUILDING* GetAvailableBuilding(int type);
  54.         UNIT* GetAvailableUnit(int type);
  55.  
  56.         //Menu variables
  57.         float money;
  58.         int unitLimit;
  59.  
  60.     private:
  61.         IDirect3DDevice9* m_pDevice;
  62.         std::vector<MAPOBJECT*> m_mapObjects;
  63.         D3DXVECTOR4 m_teamColor;
  64.         TERRAIN *m_pTerrain;
  65.         int m_teamNo, m_buildingToPlace;
  66.         bool m_areaSelect, m_placeBuilding;
  67.         INTPOINT m_startSel, m_teamStartLocation;
  68.  
  69.         UNIT *m_pSelectedUnit;
  70.  
  71.         float m_time;
  72.         float m_nextUnitUpdate;
  73.         int m_unitUpdateIndex;
  74.         int m_controller;
  75.         int m_numKills;
  76.         MASTERAI *m_pAi;
  77. };
  78.  
  79. #endif